<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<input class="int" type="text"/>
<button class="but">点击查看是否带伞</button>


    <script>
var int = document.getElementsByClassName("int")[0]
var but = document.getElementsByClassName("but")[0]
but.onclick = function(){
    var res = int.value;
    if(res=="下雨了"){
console.log("你要带伞")
    }
    else{
        console.log("不需要")
    }

}





    </script>
</body>
</html>